﻿using HardcoreGame.Common.Players;
using Terraria;
using Terraria.ModLoader;

namespace HardcoreGame.Content.Buffs
{
    internal class ExhaustionBuff : ModBuff
    {
        public override void SetStaticDefaults()
        {
            Main.debuff[Type] = true;
        }
        public override void Update(Player player, ref int buffIndex)
        {
            player.GetModPlayer<StaminaPlayer>().WillApplyExhaustion = true;
            ApplyStatusExhaustion(player);
        }
        public static void ApplyStatusExhaustion(Player player)
        {
            player.statDefense -= 5;
            player.noItems = true;
        }
        public static void ApplyMovementExhaustion(Player player)
        {
            player.maxRunSpeed *= 0.65f;
            player.accRunSpeed = player.maxRunSpeed;
            player.moveSpeed *= 0.65f;
            int maxJump = (int)(Player.jumpHeight * 0.65);
            if (player.jump > maxJump)
            {
                player.jump = maxJump;
            }
        }
    }
}
